public class NineNumber {
    //计算1到100中出现了几个9
    public static void main1(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100 ; i++) {
            if(i % 10 == 9){
                count++;
            }
            if(i / 10 == 9){
                count++;
            }
        }
        System.out.println(count);
    }

    //计算1到100中有几个包含数字9
    public static void main(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100 ; i++) {
            if(i % 10 == 9){
                count++;
            }else if(i / 10 == 9){
                count++;
            }
        }
        System.out.println(count);
    }
}
